package cn.bluedot.framework.util;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

public class WebUtils {

	/**
	 * 获取访问资源路径，去除项目名称
	 * @param req
	 * @return
	 */
	public static String getPath(HttpServletRequest req) {
		
		String requestUri = req.getRequestURI();
		String context = req.getContextPath();
		
		String path = requestUri.replace(context, "").replace(".do", "");
		
		return path;
	}
	
	/**
	 * 获取前端传入的数据
	 * @param req
	 * @return
	 */
	public static Map<String, Object[]> getRequestParams(HttpServletRequest req) {
		HashMap<String, Object[]> map = new HashMap<String, Object[]>();
		Map<String, String[]> params = req.getParameterMap();
		map.putAll(params);
		return map;
	}
	
	
	
}
